package com.jy.project.config;

import com.jy.project.filter.ParamFilter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.servlet.Filter;

@Configuration
public class FilterConfig {
    @Autowired
    ParamFilter paramFilter;

    @Bean
    public FilterRegistrationBean<Filter>  registrationBean(){
        FilterRegistrationBean<Filter> filterFilterRegistrationBean=new FilterRegistrationBean<>();
        filterFilterRegistrationBean.setFilter(paramFilter);
        filterFilterRegistrationBean.addUrlPatterns("/v1/*");
        filterFilterRegistrationBean.setName("paramFilter");
        return  filterFilterRegistrationBean;
    }
}
